import redis
class Redis():
    def __init__(self):
       pool = redis.ConnectionPool(host='localhost',port=6379)
       self.r = redis.Redis(connection_pool = pool)

    def get(self,key,val=None):
        value = self.r.get(key)
        return value if value is not None else val

    def set(self,key,val,time=7000):
        return self.r.set(key,val)

